package com.ww.learn.oop

fun process(card: Card2) = when (card) {
    is Ace2 -> "${card.javaClass.name} of ${card.suit}"
    is King2, is Queen2, is Jack2 -> "$card"
    is Pip2 -> "${card.number} of ${card.suit}"
}

fun main() {
    println(process(Ace2(Suit.DIAMOND)))
    println(process(Queen2(Suit.CLUBS)))
    println(process(Pip2(Suit.SPADES, 2)))
    println(process(Pip2(Suit.HEARTS, 6)))
}